package com.weighing.web.controller.server;

import com.weighing.common.core.controller.BaseController;
import com.weighing.common.core.domain.AjaxResult;
import com.weighing.system.domain.server.ProduceOrderDetail;
import com.weighing.system.service.server.ProduceOrderDetailService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 工单主表控制器
 * 提供工单主表及明细的查询接口
 */
@RestController
@RequestMapping("/produce/produceOrderDetail")
public class ProduceOrderDetailController extends BaseController {

    @Resource
    private ProduceOrderDetailService produceOrderDetailService;

    /**
     * 校验子件编号
     * @param subMaterialId 子件编号
     * @return 工单明细
     */
    @GetMapping("/checkSubMaterial/{billNo}/{subMaterialId}")
    public AjaxResult checkSubMaterial(@PathVariable String billNo, @PathVariable String subMaterialId) {
        ProduceOrderDetail produceOrderDetail = produceOrderDetailService.checkSubMaterial(billNo, subMaterialId);
        return AjaxResult.success(produceOrderDetail);
    }

}
